package org.mch.swingm.core;

import javax.swing.Icon;
import javax.swing.JLabel;

public class MLabel extends JLabel {
	private static final long serialVersionUID = 4432544914478259277L;

	public MLabel() {
		this("", null, LEADING);
	}

	public MLabel(Icon image, int horizontalAlignment) {
		this(null, image, horizontalAlignment);
	}

	public MLabel(Icon image) {
		this(null, image, CENTER);
	}

	public MLabel(String text, Icon icon, int horizontalAlignment) {
		super(text, icon, horizontalAlignment);
	}

	public MLabel(String text, int horizontalAlignment) {
		this(text, null, horizontalAlignment);
	}

	public MLabel(String text) {
		this(text, null, LEADING);
	}

	@Override
	public String getToolTipText() {
		return super.getToolTipText();
	}

	@Override
	public String getText() {
		return super.getText();
	}

	@Override
	public void setText(String text) {
		super.setText(text);

		if (getToolTipText() == null || getToolTipText().equals("")) {
			setToolTipText(text);
		}
	}

	@Override
	public void setToolTipText(String text) {
		super.setToolTipText(text);
	}
}
